//
//  TimeUnitTool.swift
//  CFZWeiBo
//
//  Created by Cedric Zheng on 30/11/2016.
//  Copyright © 2016 Cedric Zheng. All rights reserved.
//

import Foundation

extension Double {
    
    var sec     : Double { return self }
    
    var min     : Double { return self * 60.0 }
    
    var hour    : Double { return self * 3_600.0 }
    
    var day     : Double { return self * 86_400.0 }
    
    var week    : Double { return self * 604_800.0 }
    // Month = day * 30
    var month   : Double { return self * 2_592_000.0 }
    // Year = day * 365
    var year    : Double { return self * 31_536_000.0 }
    // Decade = year * 10
    var decade  : Double { return self * 315_360_000.0 }
    // Century = year * 100
    var century : Double { return self * 3_153_600_000.0 }
    // Millennium = year * 1,000
    var millennium: Double { return self * 31_536_000_000.0 }
    
}

extension Int {
    
    var sec     : Double { return Double(self) }
    
    var min     : Double { return Double(self) * 60.0 }
    
    var hour    : Double { return Double(self) * 3_600.0 }
    
    var day     : Double { return Double(self) * 86_400.0 }
    
    var week    : Double { return Double(self) * 604_800.0 }
    // Month = day * 30
    var month   : Double { return Double(self) * 2_592_000.0 }
    // Year = day * 365
    var year    : Double { return Double(self) * 31_536_000.0 }
    // Decade = year * 10
    var decade  : Double { return Double(self) * 315_360_000.0 }
    // Century = year * 100
    var century : Double { return Double(self) * 3_153_600_000.0 }
    // Millennium = year * 1,000
    var millennium: Double { return Double(self) * 31_536_000_000.0 }
    
}



